<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<form name="$ctrl.formACLs" novalidate style="padding: 1rem">
  <div layout="row">
    <gv-switch
      label="Private"
      flex="100"
      description="Deny access to an anonymous user and more fine grained access management with roles and groups"
      gv-model
      ng-model="acls.isPrivate"
    ></gv-switch>
  </div>

  <div layout="row">
    <md-input-container class="md-block" flex="100">
      <label>Roles</label>
      <md-select ng-model="acls.roles" multiple ng-disabled="!acls.isPrivate">
        <md-option ng-repeat="role in $ctrl.roles | orderBy:'name'" ng-value="role.id"> {{role.name}} </md-option>
      </md-select>
    </md-input-container>
  </div>

  <div layout="row">
    <md-input-container class="md-block" flex="100">
      <label>Groups</label>
      <md-select ng-model="acls.groups" multiple ng-disabled="!acls.isPrivate">
        <md-option ng-repeat="group in $ctrl.groups | orderBy:'name'" ng-value="group.id"> {{group.name}} </md-option>
      </md-select>
    </md-input-container>
  </div>

  <div layout="row">
    <gv-switch
      label="Excluded"
      flex="100"
      description="Exclude access to selected roles/groups"
      ng-disabled="!acls.isPrivate"
      ng-model="acls.excludedAccessControls"
      gv-model
    ></gv-switch>
  </div>
</form>
